﻿using AdminStystem.Domain;
using AdminSytem.Application;
using AdminSytem.Application.Cultivations;
using AdminSytem.Application.Dto;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace AdminSytem.WebApi.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class CultivationController : ControllerBase
    {
        private readonly ICultivationServices cultivationServices;

        public CultivationController(ICultivationServices cultivationServices)
        {
            this.cultivationServices = cultivationServices;
        }
        [HttpPost]
        public Task<ResultDto<int>> AddCultivation(CultivationDto dto)
        {
            return cultivationServices.AddCultivation(dto);
        }
        [HttpGet]
        public Task<ResultDto<Cultivation>> GetCultivations(int id)
        {
            return cultivationServices.GetCultivations(id);
        }
        [HttpPost]
        public Task<ResultDto<int>> AddEnterprise( EnterpriseDto dto)
        {
            return cultivationServices.AddEnterprise(dto);
        }
        [HttpGet]
        public Task<ResultDto<Enterprise>> GetEnterprise(int id)
        {
            return cultivationServices.GetEnterprise(id);
        }
        [HttpGet]
       public async Task<ResultDto<List<Provinces>>> GetProvinces()
        {
            return await cultivationServices.GetProvinces();
        }
        [HttpGet]
        public async Task<ResultDto<List<Cities>>> GetCities(string ProvinceId)
        {
            return await cultivationServices.GetCities(ProvinceId);
        }
        [HttpGet]
        public async Task<ResultDto<List<Areas>>> GetAreas(string CityId)
        {
            return await cultivationServices.GetAreas(CityId);
        }
    }
}
